using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class BagEnable : MonoBehaviour
{
    CreateImg create_image_comp;

    [Header("打开`persistent_data`文件夹")]
    public bool open_persistent_data_dir = false;
    
    [Header("打开`streaming_data`文件夹")]
    public bool open_streaming_data_dir = false;

    private void Awake()
    {
        GameObject create_img_obj = GameObject.Find("create_img");
        create_image_comp = create_img_obj.GetComponent<CreateImg>();
    }
    // Start is called before the first frame update
    void Start()
    {
        if (open_persistent_data_dir)
        {
            string parent_dir_path = BdUtils.persistant_data_dir_path; 
            string cmd = BdUtils.is_windows_platform() ? $"start {parent_dir_path}" : $"open {parent_dir_path}";
            BdUtils.CommandUtils.run_cmd(cmd);
        }
        
        if (open_streaming_data_dir)
        {
            string parent_dir_path = BdUtils.streaming_data_dir_path; 
            string cmd = BdUtils.is_windows_platform() ? $"start {parent_dir_path}" : $"open {parent_dir_path}";
            BdUtils.CommandUtils.run_cmd(cmd);
        }
        
    }
    private void OnEnable()
    {
        // var item_description = transform.Find("bottom");
        var item_description_obj = transform.Find("bottom/item_description").gameObject;
        // var path = BdTools.get_abs_path_by_obj(item_description_obj);
        // BdUtils.log("FindChild item_description --- ", path);

        var item_description_comp = item_description_obj.GetComponent<Text>();
        item_description_comp.text = "";

        create_image_comp.refresh_slot_grid();
        // var item_description_obj = transform.Find("bottom/item_description").gameObject;
    }

    // Update is called once per frame
    void Update()
    {

    }
}
